package sockety.client.interf;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;

public final class  App {
	public static void saveConfig(String [] cs){
		try {
			String path = new File(".").getCanonicalPath();
			File config = new File(path + "\\config.txt");
			config.createNewFile();
			
			PrintWriter pw = new PrintWriter(config);
			
			String saveString ="";
			for(String s: cs){
				saveString += (s + "\t");
			}
			pw.print(saveString);
			pw.close();
			
			System.out.println(path);
		} catch (IOException e1) {
			e1.printStackTrace();
		}
	}
	
	public static String [] loadConfig(){
		String [] configData = null;
		try {
			String path = new File(".").getCanonicalPath();
			File config = new File(path + "\\config.txt");
			config.createNewFile();
			
			BufferedReader br = new BufferedReader( new FileReader(config));
			String line = br.readLine();
			
			br.close();
			
			configData = line.split("\t");
			System.out.println(line);
			
		} catch (IOException e1) {
			e1.printStackTrace();
		}
		return configData;
	}
}
